<?php

/* @var $this yii\web\View */

use yii\helpers\Html;
use app\assets\ZclipAsset;
ZclipAsset::register($this);
$this->title = '生成推荐码';
$this->params['breadcrumbs'][] = $this->title;?>
<div class="page-title">
  <div>
    <h1><i class="fa fa-key"></i> 生成推荐码</h1>
    <ul class="breadcrumb side">
      <li><i class="fa fa-home fa-lg"></i></li>
      <li>操作管理</li>
      <li><a class="active" href="#">生成推荐码</a></li>
    </ul>
  </div>
</div>
<div class="card">
  <div class="jumbotron">
    <div class='container'>
      <h2>推荐码：<?=Html::encode($model['push_tjm'])?></h2>
      <h4>生成日期：<?=Html::encode($model['create_time'])?></h4>
      <p>使用该推荐码成功注册的会员将成为由你推荐的一级会员。该推荐码只能单人使用一次，7日内有效。</p>
      <p><a id='copy-button' class="btn btn-warning btn-lg" role="button" style='cursor:pointer;'  data-clipboard-text="<?=$model['push_tjm']?>" >将推荐码拷贝到剪贴板</a></p>
    </div>
  </div>
</div>
<?php $this->beginBlock('copytoclipboard') ?>
var client = new ZeroClipboard( document.getElementById("copy-button") );
client.on( "ready", function( readyEvent ) {
  // alert( "ZeroClipboard SWF is ready!" );
  client.on( "aftercopy", function( event ) {
    // `this` === `client`
    // `event.target` === the element that was clicked
    //event.target.style.display = "none";
    alert("复制成功，请粘贴到你的QQ/微信上发给被推荐人");
  } );
} );
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['copytoclipboard'],\yii\web\View::POS_END); ?>
